package vectortile.model;

import vectortile.tile.Tile;

/**
 * @Author jlj
 * @Date 2020/12/28 11:51
 * @Description GeomType is described in section 4.3.4 of the specification;
 *              Protobuf enum {@code vector_tile.Tile.GeomType}
 * @Modified
 */
public enum GeomType implements com.google.protobuf.ProtocolMessageEnum {
    /**
     * <code>UNKNOWN = 0;</code>
     */
    UNKNOWN(0),
    /**
     * <code>POINT = 1;</code>
     */
    POINT(1),
    /**
     * <code>LINESTRING = 2;</code>
     */
    LINESTRING(2),
    /**
     * <code>POLYGON = 3;</code>
     */
    POLYGON(3),
    ;

    /**
     * <code>UNKNOWN = 0;</code>
     */
    public static final int UNKNOWN_VALUE = 0;
    /**
     * <code>POINT = 1;</code>
     */
    public static final int POINT_VALUE = 1;
    /**
     * <code>LINESTRING = 2;</code>
     */
    public static final int LINESTRING_VALUE = 2;
    /**
     * <code>POLYGON = 3;</code>
     */
    public static final int POLYGON_VALUE = 3;


    public final int getNumber() {
        return value;
    }

    /**
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static GeomType valueOf(int value) {
        return forNumber(value);
    }

    public static GeomType forNumber(int value) {
        switch (value) {
            case 0:
                return UNKNOWN;
            case 1:
                return POINT;
            case 2:
                return LINESTRING;
            case 3:
                return POLYGON;
            default:
                return null;
        }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<GeomType> internalGetValueMap() {
        return internalValueMap;
    }

    private static final com.google.protobuf.Internal.EnumLiteMap<GeomType> internalValueMap =
            new com.google.protobuf.Internal.EnumLiteMap<GeomType>() {
        public GeomType findValueByNumber(int number) {
            return GeomType.forNumber(number);
        }
    };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
        return getDescriptor().getValues().get(ordinal());
    }

    public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
        return getDescriptor();
    }

    public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
        return Tile.getDescriptor().getEnumTypes().get(0);
    }

    private static final GeomType[] VALUES = values();

    public static GeomType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
        if (desc.getType() != getDescriptor()) {
            throw new java.lang.IllegalArgumentException(
                    "EnumValueDescriptor is not for this type.");
        }
        return VALUES[desc.getIndex()];
    }

    private final int value;

    private GeomType(int value) {
        this.value = value;
    }

}
